home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Fading / WhiteFade.s < prev   
Text File  |  1997-12-10  |  3KB  |  133 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      White Fade
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;Fades the screen to white, then down to a palette, and exits with a fade
  7. ;to black.  This demo can load and fade any picture that you specify at
  8. ;the end of this file.
  9. ;
  10. ;Press left mouse button to exit.
  11.  
  12.     INCDIR    "INCLUDES:"
  13.     INCLUDE    "dpkernel/dpkernel.i"
  14.  
  15.     SECTION    "Demo",CODE
  16.  
  17. ;===========================================================================;
  18. ;                             INITIALISE DEMO
  19. ;===========================================================================;
  20.  
  21.     STARTDPK
  22.  
  23. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  24.     move.l    DPKBase(pc),a6
  25.     lea    PicFile(pc),a0
  26.     moveq    #ID_PICTURE,d0
  27.     CALL    Load
  28.     move.l    d0,Picture
  29.     beq.s    .Exit
  30.  
  31.     moveq    #ID_SCREEN,d0
  32.     CALL    Get
  33.     move.l    d0,Screen
  34.     beq.s    .Exit
  35.  
  36.     move.l    Picture(pc),a0
  37.     move.l    Screen(pc),a1
  38.     move.l    PIC_Bitmap(a0),a2
  39.     move.l    BMP_Data(a2),GS_MemPtr1(a1)
  40.     CALL    CopyStructure
  41.  
  42.     move.l    Screen(pc),a0
  43.     clr.l    GS_Palette(a0)
  44.     move.l    #BLANKPALETTE,GS_Attrib(a0)
  45.     sub.l    a1,a1
  46.     CALL    Init
  47.     tst.l    d0
  48.     beq.s    .Exit
  49.  
  50.     move.l    Screen(pc),a0
  51.     CALL    Display
  52.  
  53.     bsr.s    Main
  54.  
  55. .Exit    move.l    DPKBase(pc),a6
  56.     move.l    Picture(pc),a0
  57.     CALL    Free
  58.     move.l    Screen(pc),a0
  59.     CALL    Free
  60.     MOVEM.L    (SP)+,A0-A6/D1-D7
  61.     moveq    #ERR_OK,d0
  62.     rts
  63.  
  64. ;===========================================================================;
  65. ;                                MAIN CODE
  66. ;===========================================================================;
  67.  
  68. Main:    move.l    SCRBase(pc),a6
  69.     move.l    Screen(pc),a0
  70.     move.l    GS_Bitmap(a0),a5
  71.     moveq    #$00,d7    ;d7 = FadeState (reset).
  72. .f_in    CALL    scrWaitAVBL
  73.  
  74.     moveq    #5,d1    ;d1 = Speed of fade.
  75.     move.l    Screen(pc),a0
  76.     moveq    #$000000,d2    ;d2 = Source colour
  77.     move.l    #$ffffff,d5    ;d5 = Destination colour.
  78.     moveq    #00,d3    ;d3 = Start colour
  79.     move.l    BMP_AmtColours(a5),d4    ;d4 = Amount of colours.
  80.     move.w    d7,d0    ;d0 = FadeState
  81.     CALL    scrColourMorph    ;Do the fade routine.
  82.     move.w    d0,d7    ;Has the fade finished yet?
  83.     bne.s    .f_in    ;If not, keep doing it.
  84.  
  85.     moveq    #$00,d7
  86. .f_mid    CALL    scrWaitAVBL
  87.     moveq    #2,d1    ;d1 = Speed of fade.
  88.     move.l    Screen(pc),a0
  89.     move.l    Picture(pc),a1
  90.     move.l    PIC_Palette(a1),a1    ;a1 = Palette to fade to.
  91.     addq.w    #8,a1
  92.     move.l    #$ffffff,d2    ;d2 = Colour we are fading from.
  93.     move.w    d7,d0
  94.     CALL    scrColourToPalette    ;Do the fade routine.
  95.     move.w    d0,d7    ;Has the fade finished yet?
  96.     bne.s    .f_mid    ;If not, keep doing it.
  97.  
  98.     moveq    #$00,d7
  99. .f_out    CALL    scrWaitAVBL
  100.     move.l    Screen(pc),a0
  101.     moveq    #2,d1    ;d0 = Speed of fade.
  102.     move.l    Picture(pc),a1
  103.     move.l    PIC_Palette(a1),a1    ;a1 = Palette to fade to.
  104.     addq.w    #8,a1
  105.     moveq    #$000000,d2    ;d2 = Destination colour.
  106.     move.w    d7,d0
  107.     CALL    scrPaletteToColour    ;Do the fade routine.
  108.     move.w    d0,d7    ;Has the fade finished yet?
  109.     bne.s    .f_out    ;If not, keep doing it.
  110.  
  111.     move.l    DPKBase(pc),a6
  112.     moveq    #20,d0
  113.     CALL    WaitTime
  114.     rts
  115.  
  116. ;===========================================================================;
  117. ;                                  DATA
  118. ;===========================================================================;
  119.  
  120. Screen:        dc.l  0
  121. Picture:    dc.l  0
  122. PicFile:    FILENAME "GMS:demos/data/PIC.Loading"
  123.  
  124. ;===========================================================================;
  125.  
  126. ProgName:    dc.b  "White Fade",0
  127. ProgAuthor:    dc.b  "Paul Manias",0
  128. ProgDate:    dc.b  "10 December 1997",0
  129. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1997.  Freely distributable.",0
  130. ProgShort:    dc.b  "Fading demonstration.",0
  131.         even
  132.  
  133.